<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Motos</title>
    </head>
    <body>

        <ui:composition template="./../../resources/template/facesTemplate.xhtml">
            <ui:define name="content">
                <h:form id="frmBuscar">
                    <fieldset>
                        <div class="tablaForm">
                            <div class="fila">
                                <div class="etiq"><label for="fechaVencimiento">Fecha de Vencimiento: </label></div>
                                <div class="cont"><input id="fechaVencimiento" jsfc="h:inputText" value="#{motoBean.fechaVencimiento}" size="15" maxlength="20"/>
                                </div>
                                <div class="etiq"><label for="fechaPago">Fecha de Pago: </label></div>
                                <div class="cont"><input id="fechaPago" jsfc="h:inputText" value="#{motoBean.fechaPago}" size="15" maxlength="20"/>
                                    <h:selectBooleanCheckbox id="noPagadas" title="No Pagadas" value="#{compraMotosBean.noPagadas}" label="No Pagadas"/>No Pagadas
                                </div>
                            </div>
                        </div>
                        <div class="botonera">
                            <input id="btnBuscar" class="submit" type="submit" jsfc="h:commandButton" value="Buscar" action="#{motoBean.buscar}"/>
                            <input class="submit" type="submit" jsfc="h:commandButton" value="Todos" action="#{motoBean.todos}"/>
                        </div>
                    </fieldset>
                </h:form>
                <h:form id="frm">
                    <div class="mensajes">
                        <h:messages id="messages" errorClass="messageError" infoClass="messageInfo" warnClass="messageWarn"/>
                    </div>
                    <fieldset>
                        <h:panelGroup rendered="#{not empty motoBean.lista }">
                            <div class="tablaForm">
                                <div class="fila">
                                    <div class="t_head" style="width: 2%;"></div>
                                    <div class="t_head" style="width: 20%;"><p>
                                            <a id="InkCodigo"  jsfc="h:commandLink" action="#{motoBean.listar}">Codigo
                                                <f:setPropertyActionListener value="codigo" target="#{motoBean.facade.orden.columna}"/>
                                                <f:setPropertyActionListener value="true" target="#{motoBean.facade.orden.asc}"/>
                                            </a>
                                            <h:outputText value="#{(motoBean.facade.orden.asc) ? '▲' : '▼'}"
                                                          rendered="#{motoBean.facade.orden.columna eq 'codigo'}"/></p></div>
                                    <div class="t_head" style="width: 20%;"><p>
                                            <a id="InkCodigoFabrica"  jsfc="h:commandLink" action="#{motoBean.listar}">Codigo Fábrica
                                                <f:setPropertyActionListener value="codigoFabrica" target="#{motoBean.facade.orden.columna}"/>
                                                <f:setPropertyActionListener value="true" target="#{motoBean.facade.orden.asc}"/>
                                            </a>
                                            <h:outputText value="#{(motoBean.facade.orden.asc) ? '▲' : '▼'}"
                                                          rendered="#{motoBean.facade.orden.columna eq 'codigoFabrica'}"/></p></div>
                                    <div class="t_head" style="width: 25%;"><p>
                                            <a id="InkMarca"  jsfc="h:commandLink" action="#{motoBean.listar}">Marca
                                                <f:setPropertyActionListener value="marca" target="#{motoBean.facade.orden.columna}"/>
                                                <f:setPropertyActionListener value="true" target="#{motoBean.facade.orden.asc}"/>
                                            </a>
                                            <h:outputText value="#{(motoBean.facade.orden.asc) ? '▲' : '▼'}"
                                                          rendered="#{motoBean.facade.orden.columna eq 'marca'}"/></p></div>
                                    <div class="t_head" style="width: 25%;"><p>
                                            <a id="InkModelo"  jsfc="h:commandLink" action="#{motoBean.listar}">Modelo
                                                <f:setPropertyActionListener value="modelo" target="#{motoBean.facade.orden.columna}"/>
                                                <f:setPropertyActionListener value="true" target="#{motoBean.facade.orden.asc}"/>
                                            </a>
                                            <h:outputText value="#{(motoBean.facade.orden.asc) ? '▲' : '▼'}"
                                                          rendered="#{motoBean.facade.orden.columna eq 'modelo'}"/></p></div>
                                    <div class="t_head" style="width: 25%;"><p>
                                            <a id="InkColor"  jsfc="h:commandLink" action="#{motoBean.listar}">Color
                                                <f:setPropertyActionListener value="color" target="#{motoBean.facade.orden.columna}"/>
                                                <f:setPropertyActionListener value="true" target="#{motoBean.facade.orden.asc}"/>
                                            </a>
                                            <h:outputText value="#{(motoBean.facade.orden.asc) ? '▲' : '▼'}"
                                                          rendered="#{motoBean.facade.orden.columna eq 'color'}"/></p></div>
                                </div>
                                <ui:repeat var="row" value="#{motoBean.lista}">
                                    <div class="filaTabla">
                                        <div class="d" style="width: 2%;"><input type="radio" id="radio" name="radio"
                                                                                 value="#{row.codigo}"/></div>
                                        <div class="d" style="width: 20%;"><h:outputText value="#{row.codigo}"/></div>
                                        <div class="d" style="width: 20%;"><h:outputText value="#{row.codigoFabrica}"/></div>
                                        <div class="d" style="width: 25%;"><h:outputText value="#{row.marca}"/></div>
                                        <div class="d" style="width: 25%;"><h:outputText value="#{row.modelo}"/></div>
                                        <div class="d" style="width: 25%;"><h:outputText value="#{row.color}"/></div>
                                    </div>
                                </ui:repeat>
                            </div>
                            <div class="t_footer">
                                <h:commandLink action="#{motoBean.anterior}">Anterior</h:commandLink>
                                &#160;|&#160;#{motoBean.desde + 1}..#{motoBean.facade.ultimo} de #{motoBean.facade.contador}&#160;|&#160;
                                <h:commandLink action="#{motoBean.siguiente}">Siguiente</h:commandLink>
                            </div>
                        </h:panelGroup>
                        <div class="botonera">
                            <h:commandButton id="btnNuevo" value="Nuevo" action="#{motoBean.nuevo}" styleClass="submit"/>
                            <h:commandButton id="btnModificar" value="Modificar" action="#{motoBean.modificar}" styleClass="submit" rendered="#{not empty motoBean.lista }"/>
                        </div>
                    </fieldset>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
